<!-- edu_15_2_3.html -->
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
 <head>
  <meta charset="UTF-8">
 <title>下拉菜单</title>
<script language="javascript">  
  function $(id){return document.getElementById(id);}//获取元素
  function changeImage(){  
    var index =$("game").selectedIndex;//获取下拉框中选择项
    $("show").src=$("game").options[index].value;//更改图片
  }
 </script>
</head>
  <body>
  <div  style="width:100%;text-align:center">
      <h2>购买随机赠送一只笔</h2>
      <form>
				<select id="game" onChange="changeImage()" >
					<option >--请选择--</option>
					<option  name="qw" value="/pen/1.jpg" >金属黑笔</option>
					<option  name="qw" value="/pen/2.jpg" checked>钢笔</option>
					<option  name="qw" value="/pen/3.jpg">签字笔</option>
				</select>
      </form>

  <p align="center">
      <a href="index">
      <img  src="/pen/pic1.jpg"  id="show">
      </a>
  </p>
  </div>
  </body>
</html>